package com.kotlin.myapplication.network.api

import com.kotlin.myapplication.bean.*
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

/**
 *@lil
 *@创建时间 2019/10/30 9:57
 *@描述 业务接口
 */

interface AllApi {
    //http://v.juhe.cn/calendar/day?date=2019-10-31&key=933dc930886c8c0717607f9f8bae0b48
    /**
     * 获取日历
     */
    @GET("calendar/day")
    fun calentarDay(
            @Query("date") date: String,
            @Query("key") key: String
    ): Observable<CalentarDayBean<CalentarDayResult<CalentarDayData>>>


    //http://apis.juhe.cn/simpleWeather/query?city=%E8%8B%8F%E5%B7%9E&key=
    /**
     * 获取天气
     *  get/post
     */
    @GET("simpleWeather/query")
    fun getWeather(
            @Query("city") data: String,
            @Query("key") key: String
    ): Observable<Weather<WeatherResult<realtime>>>

    /**
     * 获取新闻
     *  get/post
     */
    @GET("index")
    fun getNews(
            @Query("type") type: String,
            @Query("key") key: String
    ): Observable<NewsBean<NewsResult<RepData>>>

    /**
     * 查询本地用户信息
     */
    @GET("user/get")
    fun getUser(@Query("userId") userid: String, @Query("password") password: String): Observable<UserBean<UserData>>

    /**
     * 登录
     */
    @POST("/user/login")
    fun login(@Query("userId") userid: String,
              @Query("password") password: String
    ): Observable<UserBean<UserData>>

    /**
     * 注册新用户
     */
    @POST("register/user")
    fun register(@Query("telphone") telphone: String,
                 @Query("encrptPassWord") encrptPassWord: String,
                 @Query("name") name: String
    ): Observable<RegisterBean>
}